﻿<%@ Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Assembly Name="NikCodes.SharePoint.ClientSide, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4c65a114af13ca0d" %>
<%@ Page Language="C#" Inherits="NikCodes.SharePoint.ClientSide.DemoPage" MasterPageFile="~/_layouts/application.master" EnableViewState="false" EnableViewStateMac="false" %>
<%@ Import Namespace="Microsoft.SharePoint" %>

<asp:Content ID="WindowTitle" runat="server" ContentPlaceHolderID="PlaceHolderPageTitle">SharePoint Client Side - jQuery Demo</asp:Content>
<asp:Content ID="PageTitle" runat="server" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea">jQuery Demo</asp:Content>

<asp:Content ID="DemoJQueryUIHeader" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
</asp:Content>

<asp:Content ID="DemoJQueryUIContent" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    
    <div>
        <a href="../Settings.aspx">Back to SharePoint Client Side Settings</a>
        <br /><br />
    </div>
    
    <style type="text/css">
    .changeP{
	    color: #FFFFFF;
	    border: 2px solid #CC6633;
	    width: 150px;
	    background-color: #CC6633;
	    padding:10px;
	    line-height:1.4em;
    }
    .alert {
	    font-weight: bold;
	    color: #FFFFFF;
	    background-color: #FF0000;
	    padding: 10px;
	    text-transform:uppercase;
    }

    .addedtext{
    color:#FF0000;
    }

    pre {
    display: none;
    }
    </style>

    <div style="float:left;width:48%;margin-right:2%;">
    <h2>Examples:</h2>
    <br /><br />
    <p><strong>Example A</strong></p>
    <p>Get number of paragraphs in column 2 and display that number in an alert box. Including the one in the red box.</p>
    <input type="button" value="# of Paragraphs" class="buttonAsize" />
    <a href="#" class="codeButtonA">Show&nbsp;/&nbsp;Hide jquery code</a>

    <pre class="codeA">alert($("div.contentToChange p").size());</pre>

    <br /><br />

    <p><strong>Example B</strong></p>
    <p>Animate a paragraph in Column 2 by using a slide animation.</p>

    <input type="button" value="Slide Out" class="buttonBslideup" />
    <input type="button" value="Slide In" class="buttonBslidedown" />
    <a href="#" class="codeButtonB">Show&nbsp;/&nbsp;Hide jquery code</a>
    <pre class="codeB">$("div.contentToChange p.firstparagraph:hidden").slideDown("slow");
    $("div.contentToChange p.firstparagraph:visible").slideUp("slow");</pre>

    <br /><br />

    <p><strong>Example C</strong></p>
    <p>Add/Remove text from the end of all &lt;p&gt; elements in column 2 except the paragraph in the red box.</p>

    <input type="button" value="Add" class="buttonCAdd" />
    <input type="button" value="Remove" class="buttonCRemove" />
    <a href="#" class="codeButtonC">Show&nbsp;/&nbsp;Hide jquery code</a>

    <pre class="codeC">$("div.contentToChange p:not(.alert)")
      .append("&lt;strong class="addedtext"&gt;&nbsp;This text was just appended to this paragraph&lt;/strong&gt;")});
    $("strong.addedtext").remove();</pre>

    <br /><br />

    <p><strong>Example D</strong></p>

    <p>Remove paragraph with fade and animation.</p>
    <input type="button" value="Remove" class="buttonDhide" />
    <a href="#" class="codeButtonD">Show&nbsp;/&nbsp;Hide jquery code</a>

    <pre class="codeD">$("div.contentToChange p.thirdparagraph").hide("slow");</pre>

    <br /><br />

    <p><strong>Example E</strong></p>
    <p>Change the font weight and color of all Italic text in column 2 by adding CSS properties and values to all &lt;em&gt; elements.</p>

    <input type="button" value="Change Italics" class="buttonEitalics" />
    <a href="#" class="codeButtonE">Show&nbsp;/&nbsp;Hide jquery code</a>

    <pre class="codeE">$("div.contentToChange em").css({color:"#993300", fontWeight:"bold"});</pre>

    <br /><br />

    <p><strong>Example F</strong></p>
    <p>Change the CSS on the fifth paragraph in Column 2 by adding a class value to the &lt;p&gt; element.</p>

    <input type="button" value="Add Class" class="buttonFaddclass" />
    <input type="button" value="Remove Class" class="buttonFremoveclass" />
    <a href="#" class="codeButtonF">Show&nbsp;/&nbsp;Hide jquery code</a>

    <pre class="codeF">$("p.fifthparagraph").addClass("changeP");
    $("p.fifthparagraph").removeClass("changeP");</pre>
    </div>

    <div style="float:right;width:50%;background:#F5F5F5;" class="contentToChange">

    <p class="alert">Use the buttons to the left to run jQuery code on the HTML below.</p> 

    <p class="firstparagraph">Lorem ipsum <em>dolor</em> sit amet, consectetuer <em>adipiscing</em> elit, sed diam nonummy nibh euismod <em>tincidunt</em> ut laoreet dolore magna aliquam erat <strong>volutpat</strong>. Ut wisi enim ad minim <em>veniam</em>, quis nostrud exerci <strong>tation</strong> ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p>

    <p class="secondparagraph">Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse <strong>molestie</strong> consequat, vel illum <strong>dolore</strong> eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer <strong>adipiscing</strong> elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>

    <p class="thirdparagraph">Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea <em>commodo</em> consequat. Duis autem vel eum iriure dolor in hendrerit in <em>vulputate</em> velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te <strong>feugait</strong> nulla facilisi.</p>

    <p class="fourthparagraph">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, <strong>quis</strong> nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
    Duis autem vel eum iriure dolor in <em>hendrerit</em> in vulputate velit <em>esse</em> molestie consequat, vel illum dolore eu feugiat nulla <strong>facilisis</strong> at vero eros et accumsan et <em>iusto</em> odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te <strong>feugait</strong> nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh <strong>euismod</strong> tincidunt ut laoreet <em>dolore</em> magna aliquam erat volutpat.</p>

    <p class="fifthparagraph">Lorem ipsum <em>dolor</em> sit amet, consectetuer <em>adipiscing</em> elit, sed diam nonummy nibh euismod <em>tincidunt</em> ut laoreet dolore magna aliquam erat <strong>volutpat</strong>. Ut wisi enim ad minim <em>veniam</em>, quis nostrud exerci <strong>tation</strong> ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p>

    <p class="sixthparagraph">Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse <strong>molestie</strong> consequat, vel illum <strong>dolore</strong> eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer <strong>adipiscing</strong> elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>

    </div>
    
    <script>
    // JavaScript Document

    $(document).ready(function(){

    //Code for example A
    $("input.buttonAsize").click(function(){ alert($("div.contentToChange").find("p").size()); });
    //show code example A
    $("a.codeButtonA").click(function(){$("pre.codeA").toggle(); return false;});

    //Code for example B
    $("input.buttonBslidedown").click(function(){ $("div.contentToChange").find("p.firstparagraph:hidden").slideDown("slow"); });
    $("input.buttonBslideup").click(function(){ $("div.contentToChange").find("p.firstparagraph:visible").slideUp("slow"); });
    //show code example B
    $("a.codeButtonB").click(function(){$("pre.codeB").toggle(); return false;});

    //Code for example C
    $("input.buttonCAdd").click(function(){$("div.contentToChange").find("p").not(".alert").append("<strong class=\"addedtext\">&nbsp;This text was just appended to this paragraph</strong>")});
    $("input.buttonCRemove").click(function(){$("strong.addedtext").remove()});
    //show code example C
    $("a.codeButtonC").click(function(){$("pre.codeC").toggle(); return false;});

    //Code for example D
    $("input.buttonDhide").click(function(){ $("div.contentToChange").find("p.thirdparagraph").hide("slow"); });
    //show code example D
    $("a.codeButtonD").click(function(){$("pre.codeD").toggle(); return false;});

    //Code for example E
    $("input.buttonEitalics").click(function(){ $("div.contentToChange").find("em").css({color:"#993300", fontWeight:"bold"}); });
    //show code example E
    $("a.codeButtonE").click(function(){$("pre.codeE").toggle(); return false;});

    //Code for example F
    $("input.buttonFaddclass").click(function(){ $("p.fifthparagraph").addClass("changeP"); });
    $("input.buttonFremoveclass").click(function(){ $("p.fifthparagraph").removeClass("changeP"); });
    //show code example F
    $("a.codeButtonF").click(function(){$("pre.codeF").toggle(); return false;});

    });
    </script>  
</asp:Content>